﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="JS/jquery-1.8.0.min.js"></script>
</head>
<body>
    Name:<input type="text" id="txt3" />
    Address:<input type="text" id="txt4" />

    <input type="button" value="跨域请求" id="btn1" />
    Name:<input type="text" id="txt1" />
    Address:<input type="text" id="txt2" />
</body>
</html>
<script type="text/javascript">
    $("#btn1").click(function () {
        var url = "http://localhost:4541/TreeAjax.aspx?callback=?";
        var parm = {
            tag: 'ajaxCrossDomain',
            name: $("#txt3").val(),
            address: $("#txt4").val(),
            ran:Math.random()
        };
        $.getJSON(url, parm, function (data) {
            
            $("#txt1").val(data[0].name);
            $("#txt2").val(data[0].address);
        });
    })
</script>